JIT: always home register params on wasm#130446
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes a wasm-specific prolog correctness issue where register-parameter homing could be skipped due to calleeRegArgMaskLiveIn not being populated on wasm (since wasm uses WasmRegAlloc rather than LSRA). The change makes wasm always invoke genHomeRegisterParams during prolog generation and updates wasm’s homing filter to use ref-counts instead of entry liveness.
Changes:
- In
genFnProlog, always callgenHomeRegisterParamsunderTARGET_WASMinstead of gating oncalleeRegArgMaskLiveIn. - In wasm
genHomeRegisterParams, switch the “spill / don’t spill” decision fromfgFirstBB->bbLiveIntolvRefCnt().
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/coreclr/jit/codegenwasm.cpp | Changes wasm parameter-homing eligibility check to use ref-counts rather than entry liveness. |
| src/coreclr/jit/codegencommon.cpp | Makes wasm prolog always home register params, bypassing the calleeRegArgMaskLiveIn gate used for LSRA-based targets. |
…wasm Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
@adamperlin PTAL This gets us bit farther through SPC bring up. |
|
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Looks like we still have some older versions of node out there? |
Node version seems ok, we just need to pass |
Fixed now @AndyAyersMS |
…d on entry liveness) Squashed net diff of dotnet#130446 onto the R2R prototype branch to fix the release-only wasm param-homing miscompile (this/args read from a frame home the prolog zeroed but never populated). Cherry-picking the 3 individual commits churns codegenwasm.cpp through an intermediate refcnt-based check; the net diff is the codegencommon.cpp calleeRegArgMaskLiveIn init + unconditional genHomeRegisterParams call, plus a comment in codegenwasm.cpp. Prototype-only; for the future WASI R2R PR, not for dotnet#130051. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Rebaselines the WASI R2R prototype onto current main (67 commits, now includes dotnet#130446 param-homing merged upstream 07-12). 4 trivial conflicts resolved in favor of origin/main (jiteeversionguid.h GUID token; wasi PAL stubs/file/map comment+null-check polish that landed via dotnet#130051 squash). dotnet#130446 de-duplicated cleanly (our cherry-pick == main's merged change). Prototype-only delta preserved: dotnet#130384 (inline pinvokes, still draft upstream), GAP1 (crossgen2 Program.cs +Wasi optimistic-ISA), static-compose corerun glue + JIT-EE WasmWellKnownGlobalSymbol additions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…arity Cherry-pick InitHelpers.cs from AndyAyersMS:next-blocker-spc — InitClass and InitInstantiatedClass return void* (null) instead of void, so the compiled wasm call_indirect signature matches the interp's value-returning P_ helper convention. Fixes the class-init helper arity mismatch (Console.cctor trap) that the rebaselined corelib-R2R composite hit at func 61854 after Gates 1+2 (dotnet#130384/dotnet#130446). Prototype-only; for the future WASI R2R PR. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Always home the live params on Wasm (we do not produce or rely on the `calleeRegArgMaskLiveIn`). Initialize this anyways to avoid random behavior in case somebody does look at it. Addresses the caller-side `this`-drop blocker in #129850. SuperPMI (corelib crossgen2, browser): +28 bytes / 4 contexts / 0.00%. > [!NOTE] > This change was authored with the assistance of GitHub Copilot. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Pavel Savara <pavel.savara@gmail.com>
Always home the live params on Wasm (we do not produce or rely on the
calleeRegArgMaskLiveIn). Initialize this anyways to avoid random behavior in case somebody does look at it.Addresses the caller-side
this-drop blocker in #129850.SuperPMI (corelib crossgen2, browser): +28 bytes / 4 contexts / 0.00%.
Note
This change was authored with the assistance of GitHub Copilot.